@echo off
rem ====	MakeC2R-R2V-AIO.bat 2025-03-06
::	EndCmd

if "%~1"=="" (
	set "EndCmd=k"
) else (
	set "EndCmd=c"
)

call :Office365Activate

goto End

:Office365Activate
	rem ====	Microsoft Office Activate.zip
	set "Shortcut=%HOMEDRIVE%\PortableApps\Shortcut\Shortcut.exe"
	if /i exist "%ProgramFiles%\Microsoft Office\root\vfs\ProgramFilesCommonX64\Microsoft Shared\OFFICE16\MSOICONS.EXE" (
		call :Checkdir %PUBLIC%\desktop\Office365ProPlus\
		%Shortcut%  /T:"%HOMEDRIVE%\PortableApps\Microsoft Office Activate\C2R-R2V-AIO.cmd"  /F:"%PUBLIC%\desktop\Office365ProPlus\C2R-R2V-AIO.cmd.lnk"  /I:"%ProgramFiles%\Microsoft Office\root\vfs\ProgramFilesCommonX64\Microsoft Shared\OFFICE16\MSOICONS.EXE,12"  /A:c
	)
	exit /b

:Checkdir
	rem ====----	https://stackoverflow.com/questions/18639663/how-to-pass-command-line-parameters-with-space-in-batch-file

	if exist "%*" (
		exit /b
	)
	if not exist "%*" (
		mkdir "%*"
	)
	if exist "%*" (
		echo %* Created
	)
	exit /b

:End
	%ComSpec% /%EndCmd%